<div class="layuimini-main">

    <label class="layui-form-label required">用户id</label>
    <div class="layui-input-block">
        <input type="text" id="userId" class="layui-input" readonly="readonly">
    </div>

    <label class="layui-form-label required">用户电话</label>
    <div class="layui-input-block">
        <input type="text" id="userPhone" class="layui-input" readonly="readonly">
    </div>

    <label class="layui-form-label required">微信昵称</label>
    <div class="layui-input-block">
        <input type="text" id="userNickname" class="layui-input" readonly="readonly">
    </div>

    <label class="layui-form-label required">性别</label>
    <div class="layui-input-block">
        <input type="text" id="userSex" class="layui-input" readonly="readonly">
    </div>

    <label class="layui-form-label required">注册日期</label>
    <div class="layui-input-block">
        <input type="text" id="userRegisterDate" class="layui-input" readonly="readonly">
    </div>

    <script type="text/html" id="noBtnToolbarDemo">
        <div class="layui-btn-container">
        </div>
    </script>

    <!--该用户订单详情-->
    <table class="layui-hide" id="userOrderTable" lay-filter="currentTableFilter"></table>

</div>
<script>
    var detailUser = parent.detailUser;
    console.log(detailUser);

    // 填充用户详情
    document.getElementById("userId").value=detailUser.userId;
    document.getElementById("userPhone").value=detailUser.userPhone;
    document.getElementById("userNickname").value=detailUser.userNickname;
    document.getElementById("userSex").value=detailUser.userSex;
    document.getElementById("userRegisterDate").value=detailUser.userRegisterDate;

    layui.use(['form', 'table'], function () {
        var form = layui.form,
            layer = layui.layer,
            table = layui.table,
            $ = layui.$;

        // 给 userOrderTable 表格填入数据
        table.render({
            elem: '#userOrderTable',
            url: 'order/userOrder',
            page: false, // 关闭分页
            limit: Number.MAX_VALUE,
            where: {userId:detailUser.userId}, // 传参
            method: 'get',
            toolbar: '#noBtnToolbarDemo',
            defaultToolbar: ['filter', 'exports', 'print', {
                title: '提示',
                layEvent: 'LAYTABLE_TIPS',
                icon: 'layui-icon-tips'
            }],
            cols: [[
                {field: 'orderId', width: 100, title: '订单编号'},
                {field: 'hospitalName', width: 160, title: '下单医院'},
                {field: 'deptName', width: 160, title: '所属科室'},
                {field: 'orderPay', width: 160, title: '支付金额（元）'},
                {field: 'orderStartTime', width: 320, title: '下单时间'},
                {field: 'orderUseTime', width: 160, title: '订单时长（小时）'},
                // {title: '操作', minWidth: 150, toolbar: '#currentTableBar', align: "center"}
            ]],
            skin: 'line'
        });

        /**
         * 初始化表单，要加上，不然刷新部分组件可能会不加载
         */
        // form.render();

        // 当前弹出层，防止ID被覆盖
        var parentIndex = layer.index;

        // //监听提交
        // form.on('submit(saveBtn)', function (data) {
        //     var index = layer.alert(JSON.stringify(data.field), {
        //         title: '最终的提交信息'
        //     }, function () {
        //
        //         // 关闭弹出层
        //         layer.close(index);
        //         layer.close(parentIndex);
        //
        //     });
        //
        //
        //     return false;
        // });

    });
</script>